import request from '@/utils/request'

/**
 * 区域查询
 * @param {Object} params
 * @returns
 */
export function getAreaList(params) {
  return request({
    url: '/tissue/area/areaList',
    method: 'get',
    params
  })
}

/**
 * 区域、公司、线路下拉列表
 * @param {number} companyId
 * @returns
 */
export function getAreaOpionts(companyId) {
  return request({
    url: '/tissue/area/addQuery',
    method: 'get',
    params: { companyId }
  })
}

/**
 * 新增区域
 * @param {Object} data
 * @returns
 */
export function addArea(data) {
  return request({
    url: '/tissue/area/addArea',
    headers: { repeatSubmit: false },
    method: 'post',
    data
  })
}

/**
 * 区域详情
 * @param {String} areaId
 * @returns
 */
export function getAreaDetail(areaId) {
  return request({
    url: '/tissue/area/areaDetail',
    method: 'get',
    params: { areaId }
  })
}

/**
 * 条件查询
 * @param {Object} params
 * @returns
 */
export function getAreaListById(params) {
  return request({
    url: '/tissue/area/conditionsArea',
    method: 'get',
    params
  })
}

/**
 * 区域更新
 * @param {Object} data
 * @returns
 */
export function updateArea(data) {
  return request({
    url: '/tissue/area/updateArea',
    method: 'post',
    data
  })
}

/**
 * 禁、启用
 * @param {Object} params
 * @returns
 */
export function disableArea(params) {
  params.enabled = params.enabled == '1' ? '0' : '1'

  return request({
    url: '/tissue/area/areaProhibit',
    method: 'get',
    params
  })
}
